﻿using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using UnityEngine;

public class UI_Game_RankList : MonoBehaviour
{
    [SerializeField]
    private List<UI_Game_Rank> m_rankList;

    [ContextMenu("GET_CHILD")]
    private void m_GetChild()
    {
        m_rankList = new List<UI_Game_Rank>();
        for (int index = 0; index < this.transform.childCount; index++)
        {
            m_rankList.Add(this.transform.GetChild(index).GetComponent<UI_Game_Rank>());
        }
    }

    public void SetRankInfo(PlayerBody[] pPlayers)
    {
        var playerCount = pPlayers.Length;
        for (int index = 0; index < m_rankList.Count; ++index)
        {
            if (index < playerCount)
            {
                m_rankList[index].SetHead(null);
                m_rankList[index].SetName("");
                m_rankList[index].SetScore(0);
            }
            else
            {
                m_rankList[index].HeadSet();
            }

        }

    }

}
